﻿<%@  Language="C#" Title="Quản lý học viên - Tiếng nhật thật dễ" MasterPageFile="~/Admin/AdminMTP.Master" AutoEventWireup="true" CodeBehind="Class.aspx.cs" Inherits="SQT.tracnghiem.Admin.Class" %>

<%@ Import Namespace="DataAccess" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link href="../Content/css/educate.css" rel="stylesheet" />
    <script src="../Scripts/Chart.bundle.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="w3-row">
        <div class="class-left-content w3-col l4 w3-border-right w3-border-teal">
            <header id="class-list-header" class="class-content-header">Danh sách học viên</header>
            <div class="w3-row w3-padding">
                <select id="ddl_class" class="choose w3-teal">
                    <option value="-1" selected="selected">Chọn lớp</option>
                    <%var get_cls = (from p in new TblClassController().FetchAll() orderby p.Id descending where p.Active == true select p); %>
                    <%foreach (TblClass cls in get_cls)
                      { %>
                    <option value="<%=cls.Id %>"><%=cls.ClassName %></option>
                    <%} %>
                </select>
                <a href="../quan-ly/lop-hoc" target="_blank" class="class-manager-btn w3-btn w3-teal" title="Lớp học"><i class="fa fa-cogs"></i></a>
            </div>
            <div class="class-student-box w3-row">
                <div class="student-list">
                    <ul id="student_list" class="w3-ul w3-hoverable w3-white">
                    </ul>
                </div>
                <div id="class-list-option-btn" class="w3-padding-12 w3-center w3-hide">
                    <a class="btn_add_student w3-btn w3-teal" title="Thêm học viên"><i class="fa fa-plus"></i>&nbsp;Thêm học viên</a>
                    <a class="btn_check w3-btn w3-teal" title="Điểm danh"><i class="fa fa-edit"></i>&nbsp;Điểm danh</a>
                    <a class="btn_insert_point w3-btn w3-teal" title="Nhập điểm"><i class="fa fa-calendar-plus-o"></i>&nbsp;Nhập điểm</a>
                </div>
            </div>
        </div>
        <div class="class-right-content w3-col l8">
            <div id="student_detail_area">
            </div>
            <div id="class-report">
                <header id="class-report-header" class="class-content-header w3-teal">Thống kê</header>
                <div class="class-report-content">
                    <div class="class-diligent-report">
                        <div class="w3-padding">
                            <select class="choose w3-teal w3-padding-right">
                                <option value="1">Điểm trung bình</option>
                                <option value="2" disabled="disabled">Chuyên cần</option>
                            </select>
                            <select id="class-report-option" class="w3-hide choose w3-teal">
                                <option value="1" selected="selected">Theo ngày</option>
                                <option value="2">Theo tuần</option>
                                <option value="3">Theo tháng</option>
                            </select>
                            <select id="class-report-year" class="w3-hide w3-hide class-report-year choose w3-teal">
                                <option value="2017" selected="selected">2017</option>
                                <option value="2016">2016</option>
                            </select>
                            <select id="class-report-Sesmester" class="choose w3-teal">
                                <%var get_semester = new TblSemesterController().FetchAll();
                                    foreach(TblSemester semester in get_semester) { %>
                                <option value="<%=semester.SemesterId %>"><%=semester.SemesterName %></option>
                                <%} %>
                            </select>
                            <input id="class-report-date" type="date" value="2017-01-14" class="w3-hide class-report-date" />
                            <a id="btn_class_load_chart" class="class-manager-btn w3-btn w3-teal" title="Thống kê"><i class="fa fa-area-chart"></i></a>
                        </div>
                        <div class="class-report-canvas">
                            <div id="canvas_container" class="class-report-canvas-inner w3-white">
                                <canvas id="canvas1"></canvas>
                            </div>
                        </div>
                    </div>
                    <script src="../Ajax/JS/Class_report.js"></script>
                    <div class="class-point-report">
                        
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div id="themhocvien" class="w3-modal">
        <div class="class-add-student-modal w3-modal-content w3-animate-top w3-card-8 w3-teal">
            <header class="w3-padding w3-center">
                <span class="w3-large">Thêm học viên</span>
            </header>
            <ul id="add_student_list" class="class-student-list w3-ul w3-hoverable w3-white">
                <%
                    var get_role = new TblUserRoleController().FetchAll().First();
                    var get_student = new TblUserController().FetchAll().Where(x => x.UserLevel > 1 && x.ClassX == 0);
                    foreach (TblUser user in get_student)
                    {
                %>
                <li class="w3-padding w3-row">
                    <div class="add_student_id w3-hide"><%=user.UserId %></div>
                    <div class="add_student_select w3-hide">0</div>
                    <img src="../Content/avatar/<%=user.Avatar %>" class="student-img w3-left w3-circle" />
                    <div class="w3-col l7 w3-padding-top">
                        <span><%=user.FullName %></span>
                    </div>
                    <div class="add-col w3-col l3 w3-small">
                        <a class="add-btn w3-btn w3-teal w3-animate-right" onclick="this.style.display = 'none'; this.parentElement.getElementsByClassName('student-checked')[0].style.display = 'inline-block'; this.parentElement.getElementsByClassName('cancel-checked')[0].style.display = 'inline-block'"><i class="fa fa-plus"></i>&nbsp;Thêm</a>
                        <i class="student-checked fa fa-check w3-large w3-text-teal w3-animate-opacity w3-padding-top" style="display: none"></i>&nbsp;
                                    <i class="cancel-checked fa fa-times w3-large w3-text-red w3-animate-opacity w3-padding-top w3-padding-left" onclick="this.style.display = 'none'; this.parentElement.getElementsByClassName('student-checked')[0].style.display = 'none'; this.parentElement.getElementsByClassName('add-btn')[0].style.display = 'inline-block'" style="display: none; cursor: pointer"></i>
                    </div>
                </li>
                <%} %>
            </ul>
            <div class="w3-row w3-padding w3-center">
                <a class="w3-btn w3-teal w3-border w3-border-white" id="agree_add_student"><i class="fa fa-check"></i>&nbsp;Xác nhận</a>
                <a class="w3-btn w3-teal w3-border w3-border-white" id="cancel_add_student"><i class="fa fa-times"></i>&nbsp;Hủy</a>
            </div>
        </div>
    </div>
    <%
        string date = DateTime.Now.Year + "-";
        if (DateTime.Now.Month < 10)
            date = date + "0" + DateTime.Now.Month.ToString() + "-";
        else
            date = date + DateTime.Now.Month.ToString() + "-";
        if (DateTime.Now.Day < 10)
            date = date + "0" + DateTime.Now.Day.ToString();
        else
            date = date + DateTime.Now.Day.ToString();
        int hour = DateTime.Now.Hour;
        int shift = 2;
        if (hour >= 0 && hour <= 12)
            shift = 1;
        if (hour >= 18 && hour <= 23)
            shift = 3;
    %>
    <div id="diemdanh" class="w3-modal">
        <div class="w3-modal-content w3-animate-top w3-card-8 w3-teal">
            <header class="w3-padding w3-center">
                <span class="w3-large">Điểm danh</span>
                <input value="<%=date %>" class="class-date" type="date" id="check_date" />
                <select class="class-select" id="check_shifts">
                    <%if (shift == 1)
                      { %>
                    <option value="1" selected="selected">Sáng</option>
                    <%}
                      else
                      { %>
                    <option value="1">Sáng</option>
                    <%} %>
                    <%if (shift == 2)
                      { %>
                    <option value="2" selected="selected">Chiều</option>
                    <%}
                      else
                      { %>
                    <option value="2">chiều</option>
                    <%} %>
                    <%if (shift == 3)
                      { %>
                    <option value="3" selected="selected">Tối</option>
                    <%}
                      else
                      { %>
                    <option value="3">Tối</option>
                    <%} %>
                </select>
                <a id="btn_show_check" class="class-btn w3-btn w3-teal w3-hover-white w3-hover-text-teal" title="Chọn ngày điểm danh"><i class="fa fa-list"></i></a>
            </header>
            <ul id="check-in-list" class="class-student-list w3-ul w3-white">
            </ul>
            <div class="w3-row w3-padding w3-center">
                <a class="btn_check_student w3-btn w3-teal w3-border w3-border-white"><i class="fa fa-check"></i>&nbsp;Xác nhận</a>
                <a class="w3-btn w3-teal w3-border w3-border-white" id="cancel_check_in"><i class="fa fa-times"></i>&nbsp;Hủy</a>
            </div>
        </div>
    </div>
    <div id="nhapdiem" class="w3-modal">
        <div class="class-insert-point-modal w3-modal-content w3-animate-top w3-card-8">
            <header class="class-insert-point-header w3-teal w3-display-container">
                <i class="close-insert-point-btn fa fa-times-circle w3-closebtn w3-text-white w3-circle w3-display-topright" title="Đóng"></i>
                <div class="class-insert-point-header-text">Nhập điểm</div>
                <div class="class-insert-point-header-drop">
                    <select class="class-select" id="ddl_exam_semester">
                        <option value="0" selected="selected">Chọn học kỳ</option>
                        <%
                            foreach (TblSemester semester in get_semester)
                            {
                             %>
                        <option value="<%=semester.SemesterId %>"><%=semester.SemesterName %></option>
                        <%} %>
                    </select>
                    <select class="class-select w3-hide" id="ddl_exam_group">
                    </select>
                    <select class="class-select w3-hide" id="ddl_exam">
                    </select>
                    <a id="btn_add_score" href="javascript:;" class="create-insert-point-btn w3-btn w3-teal w3-border w3-border-white w3-hover-white w3-hover-text-teal w3-hide" title="Tạo bảng nhập điểm"><i class="fa fa-table"></i></a>
                </div>
            </header>
            <div id="class-insert-point-table" class="class-insert-point-table w3-responsive w3-hide">
                
            </div>
            <div id="class-insert-point-option" class="class-insert-point-option w3-padding w3-center w3-teal w3-hide">
                <a href="javascript:;" onclick="save_score()" class="w3-btn w3-teal w3-border w3-border-white w3-hover-white w3-hover-text-teal"><i class="fa fa-save"></i>&nbsp;Lưu</a>
                <a href="javascript:;" class="cancel-insert-point-btn w3-btn w3-teal w3-border w3-border-white w3-hover-white w3-hover-text-teal"><i class="fa fa-arrow-circle-up"></i>&nbsp;Chọn lại</a>
            </div>
        </div>
    </div>
    <div id="success-modal" class="w3-row w3-animate-right" style="position: fixed; right: 25px; bottom: 20%; display: none; z-index: 10">
        <div class="w3-teal w3-card-4 w3-center" style="padding: 20px; opacity: 0.9">
            <header class="w3-large"><i class="fa fa-check"></i>&nbsp;<span id="success_content"></span></header>
        </div>
    </div>
    <div id="error-modal" class="w3-row w3-animate-right" style="position: fixed; right: 25px; bottom: 20%; display: none; z-index: 10">
        <div class="w3-red w3-card-4 w3-center" style="padding: 20px; opacity: 0.9">
            <header class="w3-large"><i class="fa fa-times"></i>&nbsp;<span id="error_content"></span></header>
        </div>
    </div>
    <div id="chuyenlop" class="w3-modal">
        <div class="w3-modal-content w3-animate-top w3-card-8 w3-teal" style="width: 50%">
            <header class="w3-padding w3-center">
                <span onclick="this.parentElement.parentElement.parentElement.style.display='none'" class="w3-closebtn">&times;</span>
                <p class="w3-xlarge">Chuyển lớp</p>
            </header>
            <div class="w3-padding w3-row">
                <label class="w3-quarter">Chuyển tới</label>
                <select class="w3-half" style="padding: 0.5%; color: black" id="ddl_change_class">
                    <%var change_class = (from p in new TblClassController().FetchAll() orderby p.Id descending where p.Active == true select p);
                      foreach (TblClass cls in change_class)
                      {
                          if (cls.Id == 0)
                              continue;
                          var get_teacher = new TblManagerController().FetchAll().Where(x => x.ManagerId == cls.Teacher).Single();
                    %>
                    <option value="<%=cls.Id %>"><%=cls.ClassName %> - <%=get_teacher.FullName %></option>

                    <%} %>
                </select>
            </div>
            <div class="w3-row w3-padding w3-center">
                <a class="btn_change_class w3-btn w3-teal w3-border w3-border-white"><i class="fa fa-check"></i>&nbsp;Chuyển</a>
            </div>
        </div>
    </div>
    <div id="duoihoc" class="w3-modal">
        <div class="w3-modal-content w3-animate-top w3-card-8 w3-teal" style="width: 50%">
            <header class="w3-padding w3-center">
                <div class="w3-hide" id="remove_student_id"></div>
                <span onclick="this.parentElement.parentElement.parentElement.style.display='none'" class="w3-closebtn">&times;</span>
                <p class="w3-large">Bạn có chắc chắn muốn buộc học viên này thôi học hay không ?</p>
            </header>
            <div class="w3-row w3-padding w3-center">
                <a class="btn_remove_student w3-btn w3-teal w3-border w3-border-white"><i class="fa fa-check"></i>&nbsp;Có</a>
                <a onclick="this.parentElement.parentElement.parentElement.style.display='none'" class="w3-btn w3-teal w3-border w3-border-white"><i class="fa fa-times"></i>&nbsp;Không</a>
            </div>
        </div>
    </div>
    <div id="report_chart_data" class="w3-hide"></div>
    <script src="../Scripts/javacuatui3.js"></script>
</asp:Content>
